{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_excel(r'C:\\Users\\Rookie\\Desktop\\数据分析面试题（最新）.xls',sheet_name='数据')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>order_id</th>\n",
       "      <th>group_id</th>\n",
       "      <th>time</th>\n",
       "      <th>terminal_id</th>\n",
       "      <th>position</th>\n",
       "      <th>start_time</th>\n",
       "      <th>end_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>AGV19120700809000012</td>\n",
       "      <td>g10234</td>\n",
       "      <td>2019-12-07 23:00:00</td>\n",
       "      <td>T-977</td>\n",
       "      <td>1</td>\n",
       "      <td>2019-12-07 23:07:00</td>\n",
       "      <td>2019-12-07 23:11:21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>AGV19120700809000010</td>\n",
       "      <td>g10230</td>\n",
       "      <td>2019-12-07 23:00:00</td>\n",
       "      <td>T-977</td>\n",
       "      <td>5</td>\n",
       "      <td>2019-12-07 23:07:00</td>\n",
       "      <td>2019-12-07 23:23:46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>AGV19120700809000008</td>\n",
       "      <td>g10233</td>\n",
       "      <td>2019-12-07 23:00:00</td>\n",
       "      <td>T-977</td>\n",
       "      <td>3</td>\n",
       "      <td>2019-12-07 23:07:00</td>\n",
       "      <td>2019-12-07 23:20:50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>AGV19120700809000011</td>\n",
       "      <td>g10231</td>\n",
       "      <td>2019-12-07 23:00:00</td>\n",
       "      <td>T-977</td>\n",
       "      <td>4</td>\n",
       "      <td>2019-12-07 23:07:00</td>\n",
       "      <td>2019-12-07 23:22:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>AGV19120700809000009</td>\n",
       "      <td>g10232</td>\n",
       "      <td>2019-12-07 23:00:00</td>\n",
       "      <td>T-977</td>\n",
       "      <td>2</td>\n",
       "      <td>2019-12-07 23:07:00</td>\n",
       "      <td>2019-12-07 23:19:38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8258</th>\n",
       "      <td>AGV20011200809000185</td>\n",
       "      <td>g26681</td>\n",
       "      <td>2020-01-13 00:00:00</td>\n",
       "      <td>T-995</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-01-13 00:56:14</td>\n",
       "      <td>2020-01-13 01:55:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8259</th>\n",
       "      <td>AGV20011200809000190</td>\n",
       "      <td>g26678</td>\n",
       "      <td>2020-01-13 01:00:00</td>\n",
       "      <td>T-995</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-01-13 01:03:38</td>\n",
       "      <td>2020-01-13 01:57:33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8260</th>\n",
       "      <td>AGV20011200809000229</td>\n",
       "      <td>g26686</td>\n",
       "      <td>2020-01-13 01:00:00</td>\n",
       "      <td>T-995</td>\n",
       "      <td>11</td>\n",
       "      <td>2020-01-13 01:04:56</td>\n",
       "      <td>2020-01-13 01:48:19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8261</th>\n",
       "      <td>AGV20011200809000183</td>\n",
       "      <td>g26667</td>\n",
       "      <td>2020-01-13 01:00:00</td>\n",
       "      <td>T-995</td>\n",
       "      <td>21</td>\n",
       "      <td>2020-01-13 01:09:36</td>\n",
       "      <td>2020-01-13 01:32:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8262</th>\n",
       "      <td>AGV20011200809000249</td>\n",
       "      <td>g26716</td>\n",
       "      <td>2020-01-13 01:00:00</td>\n",
       "      <td>T-995</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-01-13 01:11:04</td>\n",
       "      <td>2020-01-13 02:00:13</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8263 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                  order_id group_id                 time terminal_id  \\\n",
       "0     AGV19120700809000012   g10234  2019-12-07 23:00:00       T-977   \n",
       "1     AGV19120700809000010   g10230  2019-12-07 23:00:00       T-977   \n",
       "2     AGV19120700809000008   g10233  2019-12-07 23:00:00       T-977   \n",
       "3     AGV19120700809000011   g10231  2019-12-07 23:00:00       T-977   \n",
       "4     AGV19120700809000009   g10232  2019-12-07 23:00:00       T-977   \n",
       "...                    ...      ...                  ...         ...   \n",
       "8258  AGV20011200809000185   g26681  2020-01-13 00:00:00       T-995   \n",
       "8259  AGV20011200809000190   g26678  2020-01-13 01:00:00       T-995   \n",
       "8260  AGV20011200809000229   g26686  2020-01-13 01:00:00       T-995   \n",
       "8261  AGV20011200809000183   g26667  2020-01-13 01:00:00       T-995   \n",
       "8262  AGV20011200809000249   g26716  2020-01-13 01:00:00       T-995   \n",
       "\n",
       "      position          start_time            end_time  \n",
       "0            1 2019-12-07 23:07:00 2019-12-07 23:11:21  \n",
       "1            5 2019-12-07 23:07:00 2019-12-07 23:23:46  \n",
       "2            3 2019-12-07 23:07:00 2019-12-07 23:20:50  \n",
       "3            4 2019-12-07 23:07:00 2019-12-07 23:22:09  \n",
       "4            2 2019-12-07 23:07:00 2019-12-07 23:19:38  \n",
       "...        ...                 ...                 ...  \n",
       "8258         5 2020-01-13 00:56:14 2020-01-13 01:55:48  \n",
       "8259         1 2020-01-13 01:03:38 2020-01-13 01:57:33  \n",
       "8260        11 2020-01-13 01:04:56 2020-01-13 01:48:19  \n",
       "8261        21 2020-01-13 01:09:36 2020-01-13 01:32:31  \n",
       "8262         3 2020-01-13 01:11:04 2020-01-13 02:00:13  \n",
       "\n",
       "[8263 rows x 7 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_new = data.iloc[:,:7]\n",
    "data_new"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      00:04:21\n",
       "1      00:16:46\n",
       "2      00:13:50\n",
       "3      00:15:09\n",
       "4      00:12:38\n",
       "         ...   \n",
       "8258   00:59:34\n",
       "8259   00:53:55\n",
       "8260   00:43:23\n",
       "8261   00:22:55\n",
       "8262   00:49:09\n",
       "Length: 8263, dtype: timedelta64[ns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_new.iloc[:,6]-data_new.iloc[:,5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
